
<div id="title_right">
	<p id="title_right_left"></p>
	<div id="title_right_center">
		<p class="chu_title">DANH SÁCH MẶT HÀNG</p>
	</div>
	<p id="title_right_right"></p>
</div>
<?php if($data){	
	?>
	<form method="post" action="admin.php?mod=timmathang">
	<table height="40px" width="200px" style="margin: 10px">
	<tr>
	<td><input name="mh" type="text" ><td>
	<td><input name="tim" type="submit" value="Tìm"></td>
	</tr>
	</table>
	</form>
	
			<table class="table">
		<tr class="mau2">
				<td>STT</td>
				<td> Hình Ảnh </td> 
				<td> Loại Hàng </td>
				<td width="100"> Tên Mặt Hàng </td>
				<td> Đơn Vị Tính </td>
				<td> Số Lượng </td>
				<td> Đơn Giá </td>
				<td> Mô Tả</td>
				<td> Trạng thái</td>
				<td> <img src="public/images/b_edit.png"/> Sửa </td>
				<td> <img src="public/images/b_drop.png"/> Xóa </td>
			</tr>
			
<?php	$i=1;
if (is_array($data['list'])){
	foreach ($data['list'] as $key => $value) {
		if($i%2==0){
			echo "<tr class='mau'>";
		}else
		{
			echo "<tr>";
		}
		?>
		<td><?php echo $i;?></td>
		<td><img src = "public/upload/<?php echo $value['HinhAnh'];?>" width = "60" height="60"/> </div> </td>
				<td>
				<?php
				if(is_array($data['listlh'])){
					foreach ($data['listlh'] as $item){
						if($item['MaLH']==$value['MaLH']){ 
							echo $item['TenLH'];
						}
					}
				}
				?>
				</td>
				<td><?php echo $value['TenMH'];?>  </td>
				<td><?php echo $value['DVT'];?>  </td>
				<td><?php echo $value['SoLuong'];?> </td>
				<td><?php echo $value['Gia'];?></td>
				<td><?php echo 'Đã lưu'?></td>
				<td><?php if($value['AnHien'] == 1){ echo 'Hiện';}else{ echo 'Ẩn';}?> </td>
				<td> <a href = "admin.php?mod=updatemathang&ma=<?php echo $value['MaMH'];?>"> <img src="public/images/b_edit.png"/> </a> </td>
				<td> <a href = "admin.php?mod=delmathang&ma=<?php echo $value['MaMH'];?>">  <img src="public/images/b_drop.png"/></a></td>
			</tr>
			<?php
			$i++;
				}	}	
			?>
			<tr>
		<td colspan="11">
			<button onclick="window.location.href='admin.php?mod=addmathang'">Thêm mới</button></td>
		</tr>
		</table>
<?php 
	
}
	
?>
<?php
//Xuat phan trang 
	 echo "<p align='center'>";
	 echo "<br>";
	 echo $pagelist;
	  echo "<br>";
	   echo "<br>";
	    echo "<br>";
	 echo "</p>";
?>
